<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form action="">
    用户名：<input type="text" id="userCode">
    密码：<input type="text" id="userPassword">
    <input type="button" id="denlu" value="登录">
    <input type="button" id="chongzhi" value="重置">
</form>
</body>
</html>
<script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
    $("#denlu").click(function () {
        DenLu();
    })
    function DenLu (){
        var userCode = $('#userCode').val();
        var userPassword = $('#userPassword').val();
        $.ajax({
            "url":"/papermanage/tuser/login",
            "type":"post",
            "data":{"userCode":userCode,"userPassword":userPassword},
            "dataType":"json",
            "success":function(a){
                var tUser = a.result["tUser"];
                if(tUser!=null){
                    window.location.href="/papermanage/chaxun";
                }else {
                    window.location.href="/papermanage/login";
                }
            },
            "error":function(){
                alert("服务器错误");
            }
        });
    }
</script>